Implementation of a Fail - Safe ANSI C Compiler
نویسنده
چکیده
Programs written in the C language often suffer from nasty errors due to dangling pointers and buffer overflow. Such errors in Internet server programs are often exploited by malicious attackers to “crack” an entire system, and this has become a problem affecting society as a whole. The root of these errors is usually corruption of on-memory data structures caused by out-of-bound array accesses. The C language does not provide any protection against such out-of-bound access, although recent languages such as Java, C#, Lisp and ML provide such protection. Nevertheless, the C language itself should not be blamed for this shortcoming—it was designed to provide a replacement for assembly languages (i.e., to provide flexible direct memory access through a light-weight high-level language). In other words, lack of array boundary protection is “by design.” In addition, the C language was designed more than thirty years ago when there was not enough computer power to perform a memory boundary check for every memory access. The real problem is the use of the C language for current casual programming, which does not usually require such direct memory accesses. We cannot realistically discard the C language right away, though, because there are many legacy programs written in the C language and many legacy programmers accustomed to the C language and its programming style. To alleviate this dilemma, many approaches to safe implementation of the C language have been proposed and put into use. To my knowledge, however, none of these support all the features of the ANSI C standard and prevent all unsafe operations. Some, such as StackGuard by Cowan, perform an ad hoc runtime check which can detect only specific kinds of error. Others, such as Safe C, accept only a small subset of the ANSI C standard. CCured, by Necula, comes closest to providing a solution in my opinion, but is not yet perfect. This thesis proposes the most powerful solution to this problem so far. FailSafe C is a memory-safe implementation of the full ANSI C language. More precisely, it detects and disallows all unsafe operations, yet conforms to the full ANSI C standard (including casts and unions) and even supports many of the “dirty tricks” common in many existing programs which do not strictly conform to the standard. In this work, I also propose several techniques—regarding both compiletime and runtime—to reduce the overhead of runtime checks. By using the FailSafe C compiler, programmers can easily make their programs safe without heavy rewriting or porting of their code. In the thesis, I also discuss a demonstration of
منابع مشابه
Fail-Safe ANSI-C Compiler: An Approach to Making C Programs Secure: Progress Report
It is well known that programs written in C are apt to suffer from nasty errors due to dangling pointers and/or buffer overflow. In particular, such errors in Internet servers are often exploited by malicious attackers to “crack” an entire system, which becomes even social problems nowadays. Nevertheless, it is yet unrealistic to throw away the C language at once because of legacy programs and ...
متن کاملThe Interface Definition Language for Fail-Safe C
Fail-Safe C is a safe implementation of full ANSI-C being developed by Oiwa and Sekiguchi. It uses its own internal data representations such as 2-word pointers and memory blocks with headers describing their contents. Because of this, calls to external functions compiled by conventional compilers require conversion of data representations. Moreover, for safety, many of those functions need add...
متن کاملSafe Virtual Machine for C in less than 3 KiBytes
Altreonic is using a formalised approach to embedded software engineering. One recent example is Altreonic’s novel Safe Virtual Machine for C (SVM). Tuned to the needs of embedded systems it allows to dynamically download C compiled binary code to OpenComRTOS nodes independently of the target processor. Yet, the Virtual machine requires less than 3 KiBytes of program memory (measured on an ARM ...
متن کاملProcess Migration and Transactions Using a Formal Intermediate Language
Process migration and atomic transactions are essential tools for constructing fault-tolerant distributed systems. Process migration provides location transparency, the ability to perform load-balancing and process checkpointing, and allows processes to be reconstructed after machine failures. Transactions provide fault-isolation by limiting the scope of errors, and permit speculative execution...
متن کاملAn Object-Oriented Preprocessor fit for C++
C++ has adopted the ANSI C preprocessor. Its limitations have been widely recognised. FOG, a meta-compiler for a super-set of C++, provides replacement preprocessing and introduces static meta-programming, while preserving the spirit of C++. Implementation of preprocessor functionality in an Object-Oriented style eliminates unnecessary replication from practical C++ programs and supports meta-l...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2005